<?php include './application/views/common/zhs_header.php';?>
<?php include './application/views/common/zhs_login.php';?>

<script src="/static/zhsjr/lightbox/js/lightbox.js" type="text/javascript"></script>
<link href="/static/zhsjr/lightbox/css/lightbox.css" rel="stylesheet" type="text/css" />

<div class="inv_box w">
  <div class="invbd_cont">
    <h2><?php echo CON_NAME;?> -<?php echo $borrow['ftype_name'].$borrow['id'];?> [<?php echo $borrow['title'];?>]
     <?php if($borrow['award']=='1') echo "<img title='{$borrow['funds']}%' src='/static/zhsjr/images/jiangx.png'/>{$borrow['funds']}%"; elseif($borrow['award']=='2') echo "<img  title='{$borrow['funds']}元'  src='/static/zhsjr/images/jiangx.png'/>{$borrow['funds']}元";?>　　100%本息保证</h2>

    <div class="invxq_bd1">
      <div class="xqbd_left">
        <ul class="xqbd_ul1">
           <li style="border-left:none;">理财金额<br>￥<strong><?php echo number_format($borrow['account'],2);?></strong>元
          <li>年化利率<br><strong><?php echo $borrow['apr'];?></strong>% <?php if($borrow['award']=='1'){ $borrow['funds']=$borrow['funds']*12;echo "+ {$borrow['funds']}%";}?>
         
          <li>理财期限<br>
          <?php if($borrow['is_day'] == '1') echo "<strong>".$borrow['bill_times']."</strong> 天"; else echo "<strong>".$borrow['time_limit']."</strong> 月"; ?>
        </ul>
        <ul class="xqbd_ul2">
           <li style="width:300px;">
			最小投资单位：<?php echo $borrow['lowest_account'];?>&nbsp;元<br>
			计息方式：<?php echo $borrow_work_time[$borrow['work_time']];?><br>
			计息日期：<?php if(isset($borrow['bill_starttime'])) echo date("Y-m-d H:i",$borrow['bill_starttime']);?>
			</li>
			最大投资单位：<?php if($borrow['most_account']==0) echo "无限制";else echo $borrow['most_account']." 元";?>&nbsp;<br>
			还款方式：<?php echo $borrow_style[$borrow['style']];?><br>
			还款日期：<?php if(isset($borrow['each_time'])) echo date("Y-m-d",$borrow['each_time']);?>
			</li>
        </ul>
      </div>
      <div class="xqbd_right">
          <?php // 投标中
          if ($borrow['account_yes'] < $borrow['account'] && in_array($borrow['fstatus'], array(1))){?>
         	<ul class="xqbdrg_ul">
          		<p></p>
	           <form id="investFrom" action="" method="post">
					<input type="hidden" name="id" id="bid" value="<?php echo $borrow['id'];?>">
					<input type="hidden" name="smscode" id="smscode" value="<?php echo $smscode;?>">
					<?php $ket = $borrow['account']-$borrow['account_yes'];if($ket > $user_account['use_money']) $max = $user_account['use_money']; else $max=$ket;?>
					<li><h4>可投金额：</h4><span class="red">¥ <?php echo round($ket,2);?></span></li>
					<li></li>
					<li><h4>账户余额：</h4><span class="red">¥ <?php echo number_format($user_account['use_money'],2);?></span></li>
					
					<li><h4><input type="checkbox" name="max_money" id="max_money" onclick="maxMoney(<?php echo $max;?>)"/></h4>一键投入可投金额</li>
					<li><h4>投资金额：</h4><input class="inpt_1" type="text" value="" id="account" name="account" onkeyup="hongbao(this.value)" >元</li>
					<?php if(isset($hdata1['user']['user_id']) && $tuser_account['paypassword'] == ""){?>
					<li><a class="mmbt" href="/user/zhs_paypwd.html">设置支付密码</a></li>
					<?php }else{?>
					<li><h4>支付密码：</h4><input class="jeinput inpt_1" id="paypassword" type="password" name="paypassword"></li>
					<?php }?>
					<li style="color:red; margin-top:1px;">&nbsp;&nbsp;&nbsp;* 确认购买投资产品并同意<a href="/site/zhs_zhsjr/29.html">购买协议</a></li>
					<li></li>
					<li><a  class="xqbd_btn" style="margin-top:2px;" onclick="invest()" href="javascript:void(0);"><img src="<?php echo CON_STATIC_URL; ?>zhsjr/images/inv_2.gif"></a></li>
					<li></li>
				</form>
			</ul>
			<?php }?>
			<?php  // 满标审核中
				if ($borrow['fstatus'] == 1 && $borrow['account'] <= $borrow['account_yes'] ){?>
				<ul class="mebdd">
          			<li>投资人数：<em>  <?php echo $borrow['tender_times'];?></em>人</li>
          			<span class="mmimg1"></span>
          		</ul>
			<?php }?>
			
			<?php  // 审核通过,启标，理财中,还款中
				if ($borrow['fstatus'] == 3 && $borrow['repayment_account'] > $borrow['repayment_yesaccount']){?>
				<ul class="mebdd">
          			<li>投资人数：<em>  <?php echo $borrow['tender_times'];?></em>人</li>
          			<span class="mmimg4"></span>
          		</ul>
			<?php }?>
			
			<?php // 标已结束，完成还款
				if ( $borrow['fstatus'] == 3 &&  $borrow['repayment_account'] <= $borrow['repayment_yesaccount']){?>
				<ul class="mebdd">
          			<li>投资人数：<em>  <?php echo $borrow['tender_times'];?></em>人</li>
          			<span class="mmimg3"></span>
          		</ul>
			<?php }?>

      </div>
    </div>
    <div class="invxq_bd1">
      <ul class="inv_tbs" id="inv_tbs">
        <li><a href="">项目详情</a>
        <li><a href="">资料审核</a>
        <?php if($borrow['ftype'] == 1) {?>
        <li><a href=""><?php echo $borrow['ftype_name'];?>产品介绍</a>
        <?php }?>
      </ul>

      <div class="invxq_cont" id="invxq_cont">
        <div class="xq_body">
          <ul class="xq_ul">
        		<li>
			    	<div class="invest_l_b_box_ZL">
						<div id="spec-n5">
							<div id="spec-left" class="spec-button" style="cursor: default;">
								<img src="/static/zhsjr/images/left_g.gif" class='prev' />		
							</div>
							<div id="spec-list">
								<div style="height: 200px; overflow: hidden; position: relative; z-index: 1;">
									<ul style="height:180px; width:775px;padding-top:5px;">
									<?php $i==0;foreach ($edition_list as $val){ if($val !='0'){?>
										<li><a href="/<?php echo $val;?>" rel="lightbox[roadtrip]"><img src="/<?php echo $val?>" /></a><p></p>
										</li>
									<?php }$i++;}?>
									</ul>
								</div>
							</div>
							<div id="spec-right" class="spec-button">
								<img src="/static/zhsjr/images/scroll_right.gif" class='next' />
							</div>
						</div>
					</div>         	 		
         	 	</li>
         	</ul>

<script type="text/javascript">
	//项目详情图片滚动
	$(function(){
		$("#spec-n5").slide({titCell:"#spec-left ul",mainCell:"#spec-list ul",autoPage:true,effect:"left",autoPlay:true,vis:3});

		$(".invxq_tab").slide({mainCell:".invxq_tab_bd ul",autoPlay:true,effect:"topMarquee",vis:10,interTime:30});
	})

</script>
         	<div class="invxq_bd1">
				<h3 class="invxw_title">投资记录<?php echo count($borrow_tender_list);?>次</h3>
				<div class="invxq_tab">
					<div class="invxq_tab_hd">
						<ul>
							<li>投资人</li>
							<li>投资时间</li>
							<li>投资金额(￥)</li>
							<li>状态</li>
						</ul>
					</div>
					<div class="invxq_tab_bd clearobj">
						<ul>
						<?php  foreach($borrow_tender_list as $borrow_tender){?>
							<?php if ($borrow_tender['account']>0){?>
							<li>
								<dl class="clearobj">
									<dd><div class="font_lan"><?php echo strdisplay_start($borrow_tender['username'], 2);?></div></dd>
									<dd><?php echo date('Y-m-d H:i:s',$borrow_tender['add_time']);?></dd>
									<dd><div class="font_Orange"><?php echo number_format($borrow_tender['money'],2);?></div></dd>
									<dd><div class="font_lan">
										<?php if(($borrow_tender['money'] == $borrow_tender['account']) && $borrow_tender['fstatus'] != 3){?>
									  		<font>投标成功</font>
									  	<?php }else if($borrow_tender['fstatus'] == 3){?>
									  			投标撤回
									  	<?php }else{?>
									  		投标成功
									  	<?php }?>									
										</div>
									</dd>										
								</dl>	
							</li>				
							<?php }?>
						<?php }?>
						</ul>
					</div>					
      			</div>
   	 		</div>
		</div>
        
        <div class="xq_body">
        	 <div class="xqbd">
        	 	<table>
               
               <tbody>
               <?php if ($borrow['ftype'] == 1){;?>
						 			<?php if(isset($borrow['bill_identification'])&& $borrow['bill_identification'] != ''){?>
               						<tr>
						 				<td width = "25%">真伪鉴定</td>
										<td  class='red'>
											<?php echo $borrow['bill_identification'];?>
										</td>
									</tr>	
						 			<?php }?>
									<?php if(isset($borrow['bill_unit'])&& $borrow['bill_unit'] != ''){?>
									<tr>
										<td width = "25%">鉴定单位</td>
										<td  class='red'>
										<?php echo $borrow['bill_unit'];?>
										</td>
									</tr>
									<?php }?>
									
									<?php if(isset($borrow['bill_good'])&& $borrow['bill_good'] != ''){?>
									<tr>
										<td width = "25%">完好性</td>
										<td  class='red'>
										<?php echo $borrow_good[$borrow['bill_good']];?>
										</td>
									</tr>
									<?php }?>
									<?php if(isset($borrow['bill_clarity'])&& $borrow['bill_clarity'] != ''){?>
               						<tr>
						 				<td width = "25%">字体清晰度</td>
										<td  class='red'>
											<?php echo $borrow['bill_clarity'];?>
										</td>
									</tr>	
						 			<?php }?>
						 			<?php if(isset($borrow['bill_compliance'])&&$borrow['bill_compliance'] != ''){?>
               						<tr>
						 				<td width = "25%">用章合规性</td>
										<td  class='red'>
											<?php echo $borrow['bill_compliance'];?>
										</td>
									</tr>	
						 			<?php }?>
						 			
						 			<?php if(isset($borrow_fuse[$borrow['fuse']])&&$borrow_fuse[$borrow['fuse']] != '') {?>
               						<tr>
						 				<td width = "25%">资金用途</td>
										<td  class='red'>
											<?php echo $borrow_fuse[$borrow['fuse']];?>
										</td>
									</tr>	
						 			<?php }?>
						<?php } else {?>
								<?php if(isset($borrow['bill_identification'])&& $borrow['bill_identification'] != ''){?>
               						<tr>
						 				<td width = "25%">借款人信息</td>
										<td  class='red'>
											<?php echo $borrow['bill_identification'];?>
										</td>
									</tr>	
						 			<?php }?>
									<?php if(isset($borrow['bill_unit'])&& $borrow['bill_unit'] != ''){?>
									<tr>
										<td width = "25%">借款描述</td>
										<td  class='red'>
										<?php echo $borrow['bill_unit'];?>
										</td>
									</tr>
									<?php }?>
									
									<?php if(isset($borrow['security_mode'])&& $borrow['security_mode'] != ''){?>
									<tr>
										<td width = "25%">抵押详情 </td>
										<td  class='red'>
										<?php echo $borrow['security_mode'];?>
										</td>
									</tr>
									<?php }?>
									<?php if(isset($borrow['bill_clarity'])&& $borrow['bill_clarity'] != ''){?>
               						<tr>
						 				<td width = "25%">还款来源</td>
										<td  class='red'>
											<?php echo $borrow['bill_clarity'];?>
										</td>
									</tr>	
						 			<?php }?>
						 			<?php if(isset($borrow['summary'])&& $borrow['summary'] != ''){?>
               						<tr>
						 				<td width = "25%">产品亮点</td>
										<td  class='red'>
											<?php echo $borrow['summary'];?>
										</td>
									</tr>	
						 			<?php }?>
						<?php }?>
					</tbody>
       				</table>
						</div>
				</div>
				<?php if ($borrow['ftype'] == 1){;?>
					<div class="xq_body">
		          		<div class="xqbd_3">
		            		<p><img src="/static/zhsjr/images/xq_3.jpg"></p>
		            		<p><img src="/static/zhsjr/images/xq_4.jpg"></p>
		          		</div>
		        	</div>
       			 <?php }?>
      </div>
     </div>
  </div>
</div>

<script type="text/javascript">
function hongbao(val){
	<?php if(isset($hdata1['user']['user_id'])){?>
	if($("#red_money").attr("checked")){
		var key_red = <?php echo $key_red;?>;
		var red = <?php echo  $user_account['red_money'];?>;
		var re = /^[0-9]+.?[0-9]*$/;
		if(re.test(val)){
			var moen = parseInt(val/200);
			if(moen > key_red) moen = key_red;
			else if(moen > red) moen = red;
			$("#yy_red").html(moen);
		}
	}
 <?php } ?>
}
function maxMoney(maxmoney){
	if($("#max_money").attr("checked")){
		$("#account").val(maxmoney);
		$("#account").attr("readonly",'true');
		//hongbao(maxmoney);
	}
	else {
		$("#account").val("");
		$("#account").removeAttr("readonly");
	}
}
function invest(){
	<?php if(isset($hdata1['user']['user_id'])){
		if($tuser_account['paypassword'] == ""){?>
			if(confirm("请设置密码之后购买！")){
				window.location.href='/user/zhs_paypwd.html';
			}
		<?php }else{?>
		var options = {
		type: "POST",
		url: "/borrow/zhs_tender",
		success: function(msg){
	        if(msg=='1'){
	        	alert("投标成功");
	        	window.location.reload();
	        }else if(msg != ""){
	        	alert(msg);
	        	<?php if(isset($hdata1['user']['user_id']) && ($tuser_account['paypassword'] == "" || $tuser_account['real_status'] != "1" )) echo "window.location.href='/user/zhs_user_safe.html';";
	        	else echo "window.location.reload();"; ?>
		    }
		},
		dataType: "text"
	};
	$("#investFrom").ajaxSubmit(options);
	<?php } }else {?>
	if(confirm("请确定登录之后购买！")){
		window.location.href='/login.html';
	}
	<?php }?>
}

</script>


<?php include './application/views/common/zhs_footer.php';?>

<?php include './application/views/common/zhs_right.php';?>
